POV-Ray : Newsgroups : povray.advanced-users : Beveled text attempt : Re: Beveled text attempt Server Time
29 Jul 2024 20:14:12 EDT (-0400)
  Re: Beveled text attempt  
From: Chris Huff
Date: 16 Dec 2000 19:21:33
Message: <chrishuff-3C0143.19223516122000@news.povray.org>
In article <chrishuff-9E96F6.16095916122000@news.povray.org>, Chris 
Huff <chr### [at] maccom> wrote:

> I'll try to work up a useful macro for this.

It's not perfect (it has problems with some sharp corners), but it works.
BevelText(String, Cuts, BevelAng, BevelDepth, Depth, Offset)
String: the text string
Cuts: the number of "cuts" to use to get the bevel effect.
BevelAng: the angle of the bevel.
BevelDepth: the thickness of the bevelled portion.
Depth: the total thickness of the text object
Offset: the offset vector for the text object. Might screw stuff up...


#macro Shear(A, B, C)
    matrix <    A.x, A.y, A.z,
                B.x, B.y, B.z,
                C.x, C.y, C.z,
                0, 0, 0>
#end

#macro BevelText(String, Cuts, BevelAng, BevelDepth, Depth, Offset)
    union {
        text {ttf "crystal.ttf", String Depth-BevelDepth, Offset}
        intersection {
            #local J=0;
            #while(J<Cuts)
                #local A = 2*pi*J/(Cuts);
                #local CA = cos(radians(BevelAng));
                #local SA = sin(radians(BevelAng));
                text {ttf "crystal.ttf", String BevelDepth, Offset
                    translate -z*(BevelDepth+J*0.0001)
                    Shear(x, y, < cos(A)*SA, sin(A)*SA, CA>/CA)
                }
                #local J=J+1;
            #end
        }
        translate z*BevelDepth
    }
#end

object {BevelText("POV", 6, 45, 0.02, 0.3, 0)
    texture {
        pigment {color White}
        finish {
            specular 1 roughness 0.02
            metallic reflect_metallic
            diffuse 0.7 ambient 0 reflection 0.25
        }
    }
}

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.